package com.example.james.uicustomviews;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;

/**
 * Created by James on 1/23/2018.
 */

public class TitleLayout extends LinearLayout implements View.OnClickListener{
    public TitleLayout(Context context, AttributeSet attrs) {
        super(context,attrs);
        LayoutInflater.from(context).inflate(R.layout.title, this  );
        Button button = findViewById(R.id.title_back);
        Button button1 = findViewById(R.id.title_edit);
        button.setOnClickListener(this);
        button1.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.title_back:
                Toast.makeText(getContext(), "Back", Toast.LENGTH_LONG).show();
                break;
            case R.id.title_edit:
                Toast.makeText(getContext(), "Edit", Toast.LENGTH_LONG).show();
                break;
            default:
                break;
        }
    }
}
